# -*- coding: utf-8 -*-
# Author: xiantingDeng
# File: execute.py
# Time: 10:40


import time

from common.element.browser import AcquireBrowser
from common.element.element import WebTools
from common.utils.file_util import get_data_newtheme
from common.utils.read_util import OperationYaml
from page.clicks.handler import ClicksHandler


class ClicksBiz():
    def __init__(self, driver, log):
        self.__log = log
        self.__driver = WebTools(driver, log)
        self.handler = ClicksHandler(driver, log)
        self.explain = OperationYaml("clicks.yaml")
        self.upload = AcquireBrowser(driver, log)



    def free_to_play(self):
        self.__driver.Jumpwepage("http://sahitest.com/demo/clicks.htm")
        self.__driver.click_element(self.handler.get_ckick_me(),self.explain.get_annotation("ckick_me"))
        self.__driver.act_double_click(self.handler.get_dbl_ckick_me(),self.explain.get_annotation("dbl_ckick_me"))
        self.__driver.more_choose(self.handler.get_name_text(),["Click me","SMC2"],self.explain.get_annotation("name_text"))
        self.__driver.act_context_click(self.handler.get_right_click_me(),self.explain.get_annotation("right_click_me"))
        self.__driver.click_element(self.handler.get_clear_button(),self.explain.get_annotation("clear_button"))

if __name__ == '__main__':
    from common.utils.log_util import logger
    from selenium import webdriver
    driver = webdriver.Chrome()
    ClicksBiz(driver,logger()).free_to_play()